package com.mars.push.core.ctrl;

import com.mars.fw.web.reponse.IRCode;
import com.mars.fw.web.reponse.King;
import com.mars.fw.web.reponse.KingCode;
import com.mars.push.api.dto.PushImMessageInput;
import com.mars.push.core.im.ImAndroidPushService;
import com.mars.push.core.im.ImIosPushService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 有指定消息的推送的接口
 *
 * @Author King
 * @create 2020/5/25 10:34
 */
@Api(tags = "【VV Work Im】推送接口")
@RestController
@RequestMapping(value = "/api/v1/push/im")
public class VvImPushServerController {

    @Autowired
    private ImAndroidPushService androidPushService;

    @Autowired
    private ImIosPushService iosPushService;

    @ApiOperation(value = "IM android 推送接口")
    @PostMapping(value = "/android")
    public King androidPush(@RequestBody PushImMessageInput input) {
        return King.success(KingCode.SUCCESS, androidPushService.pushAssign(input));
    }

    @ApiOperation(value = "IM ios 推送接口")
    @PostMapping(value = "/ios")
    public King iosPush(@RequestBody PushImMessageInput input) {
        return King.success(KingCode.SUCCESS, iosPushService.pushAssign(input));
    }
}
